package com.ithema.service.impl;

import com.ithema.dao.UserDao;
import com.ithema.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import sun.reflect.generics.scope.Scope;

import javax.annotation.Resource;

// <bean id="userService" class="com.ithema.service.impl.UserServiceImpl">
//@Component("userService")
@Service("userService")
public class UserServiceImpl implements UserService {

   /* @Value("${jdbc.driver}")
    private String driver;*/

    //<property name="userDao" ref="userDao"/>
   /* @Autowired //按照类型获取
    @Qualifier("userDao")*/  //按照id获取
   @Resource(name="userDao")   //相当于@Autowired  +  @Qualifier

    private UserDao userDao;

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }

    @Override
    public void save() {
       // System.out.println(driver);
        userDao.save();

    }
}
